#pragma once
#include <algorithm>
#include <iostream>
#include <vector>
#include <set>

std::vector<int> solve(std::vector<int> vec){
	std::reverse(vec.begin(), vec.end());
	std::set<int> s;
	auto pred = [&s](int x){ return !s.insert(x).second;};
	auto it = std::remove_if(vec.begin(), vec.end(), pred);
	vec.erase(it, vec.end());
	std::reverse(vec.begin(), vec.end());
	return vec;
}
